/**
  ******************************************************************************
  * @文件     i2c.h
  * @作者     hero_cao
  * @版本     V1.0.0
  * @日期     2025/06/18
  * @概要     i2c初始化库
  ******************************************************************************
  */
 
 /* Define to prevent recursive inclusion -------------------------------------*/
#ifndef __I2C_H_
#define __I2C_H_

/* Includes ------------------------------------------------------------------*/
#include "./board/bsp.h"


/* Exported types ------------------------------------------------------------*/
/* Exported constants --------------------------------------------------------*/
/* Exported macro ------------------------------------------------------------*/
#define IIC_SCL_H		gpio_bits_set(GPIOD, GPIO_PINS_3)
#define IIC_SCL_L		gpio_bits_reset(GPIOD, GPIO_PINS_3)
#define IIC_SDA_H		gpio_bits_set(GPIOC, GPIO_PINS_6)
#define IIC_SDA_L		gpio_bits_reset(GPIOC, GPIO_PINS_6)
#define IIC_READ_SDA    gpio_input_data_bit_read(GPIOC, GPIO_PINS_6)

/* Exported functions ------------------------------------------------------- */
void iic_init(void);
void iic_start(void);
void iic_stop(void);
void iic_ack(void);
void iic_nack(void);
uint8_t iic_wait_ack(void);
void iic_send_byte(uint8_t txd);
uint8_t iic_read_byte(unsigned char ack);

#endif /* __I2C_H_ */

